<template>
<div class="writedata">
      <!-- 完善资料页面 -->
      <div class="writedata-one">
          <h3>完善资料</h3>
          <p @click="back()">&lt;</p>
      </div>
      <div class="writedata-two">
          <div>
              用户名<input ref="userName" autofocus type="text" class="user-name" placeholder="用于取餐时对你的称呼">
          </div>
          <div>
              性别<input type="radio" class="user-age" name="age"><span class="user-age-text">先生</span><input  checked  class="user-age" type="radio" name="age"><span class="user-age-text">女士</span>
          </div>
          
      </div>
      <div @click="login()" class="writedata-three">确定</div>
      
</div>

</template>

<script>
import { Dialog } from 'vant';
// Dialog({ message: '提示' });
export default {
    methods:{
        back(){
            this.$router.go(-1)
        },
        login(){
            if(this.$refs.userName.value!=""){
                this.$store.commit("loglog")
                this.$router.replace("/home")
            }else{
                // 没有填写名字不让提交
                Dialog.alert({
                    message: '请您填写信息',
                    }).then(() => {
                    console.log("未填写数据")
                });
            }
           
        }
    }
}
</script>

<style>
html,body{
    height: 100%;
    background-color: #f5f5f5;
}
</style>
<style scoped>
.writedata{
    padding: 0.1rem;
}

.writedata-one{
    height: 0.6rem;
    font-size: 0.2rem;
    text-align: center;
    line-height: 0.6rem;
    position: relative;
}
.writedata-one>p{
    position: absolute;
    top: 50%;
    left: 2%;
    font-size: 0.3rem;
    color: #000;
    transform: translateY(-50%);
}
.writedata-two{
    height: 1.24rem;
    border-radius: 0.1rem;
    background-color: #ffffff;
    padding-left: 0.2rem;
    font-size: 0.14rem;
}
.writedata-two>div{
    /* flex: 1; */
    height: 0.62rem;
    line-height: 0.62rem;
}
.writedata-three{
    height: 0.45rem;
    background-color: #c5cfe7;
    color: #ffffff;
    text-align: center;
    line-height: 0.45rem;
}
.user-name{
    border: none;
    margin-left: 0.1rem;
    color: #9e9d9d;
}
.user-age-text{
    margin-right:0.3rem;
    margin-left:0.08rem;
}
.user-age{
    margin-left:0.3rem;
}
.writedata-three{
    margin-top: 0.26rem;
    border-radius: 0.3rem;
}

</style>